package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {

    /**
     * 菜品分页查询
     *
     * @param dishPageQueryDTO
     * @return
     */
    List<DishVO> searchDish(DishPageQueryDTO dishPageQueryDTO, int start);

    Long getCount(DishPageQueryDTO dishPageQueryDTO);


    /**
     * 根据分类id查询菜品
     *
     * @param id
     * @return
     */
    @Select("select *from dish where category_id = #{id}")
    List<Dish> getTypeDish(Integer id);


    /**
     * 根据ID查询菜品
     *
     * @param id
     * @return
     */
    @Select("select *from dish where id = #{id}")
    DishVO getIdDish(Integer id);


    /**
     * 新增菜品
     *
     * @return
     */
    @AutoFill(value = OperationType.INSERT)
    void addDish(Dish dish);

    void addflavors(DishFlavor dishFlavor);

    String getCateName(Long categoryId);

    ArrayList<DishFlavor> getList(Long id);


    /**
     * 启用状态设置
     *
     * @param status
     * @param id
     * @return
     */
    void qi(short status, Long id);

    void shan(Integer[] ids);

    void shanF(Integer[] ids);

    @AutoFill(value = OperationType.UPDATE)
    void xiugai(Dish dish);

    void xiugaiF(DishFlavor dishFlavor,long id);

    void xiugaishan(DishDTO dishDTO);

    List<Integer> chaStatus(Integer[] ids);

    List<Dish> UserDish(Integer categoryId);

    List<DishFlavor> HavingF(Long id);

    Integer countByMap(Map map);
}
